3.2.31 \(\int (a g+b g x) (A+B \log (\frac {e (a+b x)^2}{(c+d x)^2}))^2 \, dx\) [131]

3.2.31.1 Optimal result
3.2.31.2 Mathematica [A] (verified)
3.2.31.3 Rubi [A] (verified)
3.2.31.4 Maple [F]
3.2.31.5 Fricas [F]
3.2.31.6 Sympy [F(-1)]
3.2.31.7 Maxima [B] (verification not implemented)
3.2.31.8 Giac [F]
3.2.31.9 Mupad [F(-1)]

3.2.31.1 Optimal result

Integrand size = 32, antiderivative size = 188 \[ \int (a g+b g x) \left (A+B \log \left (\frac {e (a+b x)^2}{(c+d x)^2}\right )\right )^2 \, dx=-\frac {2 B (b c-a d) g (a+b x) \left (A+B \log \left (\frac {e (a+b x)^2}{(c+d x)^2}\right )\right )}{b d}+\frac {g (a+b x)^2 \left (A+B \log \left (\frac {e (a+b x)^2}{(c+d x)^2}\right )\right )^2}{2 b}-\frac {2 B (b c-a d)^2 g \left (A+2 B+B \log \left (\frac {e (a+b x)^2}{(c+d x)^2}\right )\right ) \log \left (\frac {b c-a d}{b (c+d x)}\right )}{b d^2}-\frac {4 B^2 (b c-a d)^2 g \operatorname {PolyLog}\left (2,\frac {d (a+b x)}{b (c+d x)}\right )}{b d^2} \]

output
-2*B*(-a*d+b*c)*g*(b*x+a)*(A+B*ln(e*(b*x+a)^2/(d*x+c)^2))/b/d+1/2*g*(b*x+a 
)^2*(A+B*ln(e*(b*x+a)^2/(d*x+c)^2))^2/b-2*B*(-a*d+b*c)^2*g*(A+2*B+B*ln(e*( 
b*x+a)^2/(d*x+c)^2))*ln((-a*d+b*c)/b/(d*x+c))/b/d^2-4*B^2*(-a*d+b*c)^2*g*p 
olylog(2,d*(b*x+a)/b/(d*x+c))/b/d^2
 
3.2.31.2 Mathematica [A] (verified)

Time = 0.12 (sec) , antiderivative size = 207, normalized size of antiderivative = 1.10 \[ \int (a g+b g x) \left (A+B \log \left (\frac {e (a+b x)^2}{(c+d x)^2}\right )\right )^2 \, dx=\frac {g \left ((a+b x)^2 \left (A+B \log \left (\frac {e (a+b x)^2}{(c+d x)^2}\right )\right )^2-\frac {4 B (b c-a d) \left (A b d x+B d (a+b x) \log \left (\frac {e (a+b x)^2}{(c+d x)^2}\right )-2 B (b c-a d) \log (c+d x)-(b c-a d) \left (A+B \log \left (\frac {e (a+b x)^2}{(c+d x)^2}\right )\right ) \log (c+d x)+B (b c-a d) \left (\left (2 \log \left (\frac {d (a+b x)}{-b c+a d}\right )-\log (c+d x)\right ) \log (c+d x)+2 \operatorname {PolyLog}\left (2,\frac {b (c+d x)}{b c-a d}\right )\right )\right )}{d^2}\right )}{2 b} \]

input
Integrate[(a*g + b*g*x)*(A + B*Log[(e*(a + b*x)^2)/(c + d*x)^2])^2,x]
 
output
(g*((a + b*x)^2*(A + B*Log[(e*(a + b*x)^2)/(c + d*x)^2])^2 - (4*B*(b*c - a 
*d)*(A*b*d*x + B*d*(a + b*x)*Log[(e*(a + b*x)^2)/(c + d*x)^2] - 2*B*(b*c - 
 a*d)*Log[c + d*x] - (b*c - a*d)*(A + B*Log[(e*(a + b*x)^2)/(c + d*x)^2])* 
Log[c + d*x] + B*(b*c - a*d)*((2*Log[(d*(a + b*x))/(-(b*c) + a*d)] - Log[c 
 + d*x])*Log[c + d*x] + 2*PolyLog[2, (b*(c + d*x))/(b*c - a*d)])))/d^2))/( 
2*b)
 
3.2.31.3 Rubi [A] (verified)

Time = 0.49 (sec) , antiderivative size = 220, normalized size of antiderivative = 1.17, number of steps used = 6, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.156, Rules used = {2950, 2781, 2784, 2754, 2838}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int (a g+b g x) \left (B \log \left (\frac {e (a+b x)^2}{(c+d x)^2}\right )+A\right )^2 \, dx\)

\(\Big \downarrow \) 2950

\(\displaystyle g (b c-a d)^2 \int \frac {(a+b x) \left (A+B \log \left (\frac {e (a+b x)^2}{(c+d x)^2}\right )\right )^2}{(c+d x) \left (b-\frac {d (a+b x)}{c+d x}\right )^3}d\frac {a+b x}{c+d x}\)

\(\Big \downarrow \) 2781

\(\displaystyle g (b c-a d)^2 \left (\frac {(a+b x)^2 \left (B \log \left (\frac {e (a+b x)^2}{(c+d x)^2}\right )+A\right )^2}{2 b (c+d x)^2 \left (b-\frac {d (a+b x)}{c+d x}\right )^2}-\frac {2 B \int \frac {(a+b x) \left (A+B \log \left (\frac {e (a+b x)^2}{(c+d x)^2}\right )\right )}{(c+d x) \left (b-\frac {d (a+b x)}{c+d x}\right )^2}d\frac {a+b x}{c+d x}}{b}\right )\)

\(\Big \downarrow \) 2784

\(\displaystyle g (b c-a d)^2 \left (\frac {(a+b x)^2 \left (B \log \left (\frac {e (a+b x)^2}{(c+d x)^2}\right )+A\right )^2}{2 b (c+d x)^2 \left (b-\frac {d (a+b x)}{c+d x}\right )^2}-\frac {2 B \left (\frac {(a+b x) \left (B \log \left (\frac {e (a+b x)^2}{(c+d x)^2}\right )+A\right )}{d (c+d x) \left (b-\frac {d (a+b x)}{c+d x}\right )}-\frac {\int \frac {A+2 B+B \log \left (\frac {e (a+b x)^2}{(c+d x)^2}\right )}{b-\frac {d (a+b x)}{c+d x}}d\frac {a+b x}{c+d x}}{d}\right )}{b}\right )\)

\(\Big \downarrow \) 2754

\(\displaystyle g (b c-a d)^2 \left (\frac {(a+b x)^2 \left (B \log \left (\frac {e (a+b x)^2}{(c+d x)^2}\right )+A\right )^2}{2 b (c+d x)^2 \left (b-\frac {d (a+b x)}{c+d x}\right )^2}-\frac {2 B \left (\frac {(a+b x) \left (B \log \left (\frac {e (a+b x)^2}{(c+d x)^2}\right )+A\right )}{d (c+d x) \left (b-\frac {d (a+b x)}{c+d x}\right )}-\frac {\frac {2 B \int \frac {(c+d x) \log \left (1-\frac {d (a+b x)}{b (c+d x)}\right )}{a+b x}d\frac {a+b x}{c+d x}}{d}-\frac {\log \left (1-\frac {d (a+b x)}{b (c+d x)}\right ) \left (B \log \left (\frac {e (a+b x)^2}{(c+d x)^2}\right )+A+2 B\right )}{d}}{d}\right )}{b}\right )\)

\(\Big \downarrow \) 2838

\(\displaystyle g (b c-a d)^2 \left (\frac {(a+b x)^2 \left (B \log \left (\frac {e (a+b x)^2}{(c+d x)^2}\right )+A\right )^2}{2 b (c+d x)^2 \left (b-\frac {d (a+b x)}{c+d x}\right )^2}-\frac {2 B \left (\frac {(a+b x) \left (B \log \left (\frac {e (a+b x)^2}{(c+d x)^2}\right )+A\right )}{d (c+d x) \left (b-\frac {d (a+b x)}{c+d x}\right )}-\frac {-\frac {\log \left (1-\frac {d (a+b x)}{b (c+d x)}\right ) \left (B \log \left (\frac {e (a+b x)^2}{(c+d x)^2}\right )+A+2 B\right )}{d}-\frac {2 B \operatorname {PolyLog}\left (2,\frac {d (a+b x)}{b (c+d x)}\right )}{d}}{d}\right )}{b}\right )\)

input
Int[(a*g + b*g*x)*(A + B*Log[(e*(a + b*x)^2)/(c + d*x)^2])^2,x]
 
output
(b*c - a*d)^2*g*(((a + b*x)^2*(A + B*Log[(e*(a + b*x)^2)/(c + d*x)^2])^2)/ 
(2*b*(c + d*x)^2*(b - (d*(a + b*x))/(c + d*x))^2) - (2*B*(((a + b*x)*(A + 
B*Log[(e*(a + b*x)^2)/(c + d*x)^2]))/(d*(c + d*x)*(b - (d*(a + b*x))/(c + 
d*x))) - (-(((A + 2*B + B*Log[(e*(a + b*x)^2)/(c + d*x)^2])*Log[1 - (d*(a 
+ b*x))/(b*(c + d*x))])/d) - (2*B*PolyLog[2, (d*(a + b*x))/(b*(c + d*x))]) 
/d)/d))/b)
 

3.2.31.3.1 Defintions of rubi rules used

rule 2754
Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))^(p_.)/((d_) + (e_.)*(x_)), x_Symb 
ol] :> Simp[Log[1 + e*(x/d)]*((a + b*Log[c*x^n])^p/e), x] - Simp[b*n*(p/e) 
  Int[Log[1 + e*(x/d)]*((a + b*Log[c*x^n])^(p - 1)/x), x], x] /; FreeQ[{a, 
b, c, d, e, n}, x] && IGtQ[p, 0]
 

rule 2781
Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))^(p_.)*((f_.)*(x_))^(m_.)*((d_) + 
(e_.)*(x_))^(q_), x_Symbol] :> Simp[(-(f*x)^(m + 1))*(d + e*x)^(q + 1)*((a 
+ b*Log[c*x^n])^p/(d*f*(q + 1))), x] + Simp[b*n*(p/(d*(q + 1)))   Int[(f*x) 
^m*(d + e*x)^(q + 1)*(a + b*Log[c*x^n])^(p - 1), x], x] /; FreeQ[{a, b, c, 
d, e, f, m, n, q}, x] && EqQ[m + q + 2, 0] && IGtQ[p, 0] && LtQ[q, -1]
 

rule 2784
Int[((a_.) + Log[(c_.)*(x_)^(n_.)]*(b_.))*((f_.)*(x_))^(m_.)*((d_) + (e_.)* 
(x_))^(q_.), x_Symbol] :> Simp[(f*x)^m*(d + e*x)^(q + 1)*((a + b*Log[c*x^n] 
)/(e*(q + 1))), x] - Simp[f/(e*(q + 1))   Int[(f*x)^(m - 1)*(d + e*x)^(q + 
1)*(a*m + b*n + b*m*Log[c*x^n]), x], x] /; FreeQ[{a, b, c, d, e, f, m, n}, 
x] && ILtQ[q, -1] && GtQ[m, 0]
 

rule 2838
Int[Log[(c_.)*((d_) + (e_.)*(x_)^(n_.))]/(x_), x_Symbol] :> Simp[-PolyLog[2 
, (-c)*e*x^n]/n, x] /; FreeQ[{c, d, e, n}, x] && EqQ[c*d, 1]
 

rule 2950
Int[((A_.) + Log[(e_.)*((a_.) + (b_.)*(x_))^(n_.)*((c_.) + (d_.)*(x_))^(mn_ 
)]*(B_.))^(p_.)*((f_.) + (g_.)*(x_))^(m_.), x_Symbol] :> Simp[(b*c - a*d)^( 
m + 1)*(g/b)^m   Subst[Int[x^m*((A + B*Log[e*x^n])^p/(b - d*x)^(m + 2)), x] 
, x, (a + b*x)/(c + d*x)], x] /; FreeQ[{a, b, c, d, e, f, g, A, B, n}, x] & 
& EqQ[n + mn, 0] && IGtQ[n, 0] && NeQ[b*c - a*d, 0] && IntegersQ[m, p] && E 
qQ[b*f - a*g, 0] && (GtQ[p, 0] || LtQ[m, -1])
 
3.2.31.4 Maple [F]

\[\int \left (b g x +a g \right ) {\left (A +B \ln \left (\frac {e \left (b x +a \right )^{2}}{\left (d x +c \right )^{2}}\right )\right )}^{2}d x\]

input
int((b*g*x+a*g)*(A+B*ln(e*(b*x+a)^2/(d*x+c)^2))^2,x)
 
output
int((b*g*x+a*g)*(A+B*ln(e*(b*x+a)^2/(d*x+c)^2))^2,x)
 
3.2.31.5 Fricas [F]

\[ \int (a g+b g x) \left (A+B \log \left (\frac {e (a+b x)^2}{(c+d x)^2}\right )\right )^2 \, dx=\int { {\left (b g x + a g\right )} {\left (B \log \left (\frac {{\left (b x + a\right )}^{2} e}{{\left (d x + c\right )}^{2}}\right ) + A\right )}^{2} \,d x } \]

input
integrate((b*g*x+a*g)*(A+B*log(e*(b*x+a)^2/(d*x+c)^2))^2,x, algorithm="fri 
cas")
 
output
integral(A^2*b*g*x + A^2*a*g + (B^2*b*g*x + B^2*a*g)*log((b^2*e*x^2 + 2*a* 
b*e*x + a^2*e)/(d^2*x^2 + 2*c*d*x + c^2))^2 + 2*(A*B*b*g*x + A*B*a*g)*log( 
(b^2*e*x^2 + 2*a*b*e*x + a^2*e)/(d^2*x^2 + 2*c*d*x + c^2)), x)
 
3.2.31.6 Sympy [F(-1)]

Timed out. \[ \int (a g+b g x) \left (A+B \log \left (\frac {e (a+b x)^2}{(c+d x)^2}\right )\right )^2 \, dx=\text {Timed out} \]

input
integrate((b*g*x+a*g)*(A+B*ln(e*(b*x+a)**2/(d*x+c)**2))**2,x)
 
output
Timed out
 
3.2.31.7 Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 727 vs. \(2 (185) = 370\).

Time = 0.31 (sec) , antiderivative size = 727, normalized size of antiderivative = 3.87 \[ \int (a g+b g x) \left (A+B \log \left (\frac {e (a+b x)^2}{(c+d x)^2}\right )\right )^2 \, dx=\frac {1}{2} \, A^{2} b g x^{2} + 2 \, {\left (x \log \left (\frac {b^{2} e x^{2}}{d^{2} x^{2} + 2 \, c d x + c^{2}} + \frac {2 \, a b e x}{d^{2} x^{2} + 2 \, c d x + c^{2}} + \frac {a^{2} e}{d^{2} x^{2} + 2 \, c d x + c^{2}}\right ) + \frac {2 \, a \log \left (b x + a\right )}{b} - \frac {2 \, c \log \left (d x + c\right )}{d}\right )} A B a g + {\left (x^{2} \log \left (\frac {b^{2} e x^{2}}{d^{2} x^{2} + 2 \, c d x + c^{2}} + \frac {2 \, a b e x}{d^{2} x^{2} + 2 \, c d x + c^{2}} + \frac {a^{2} e}{d^{2} x^{2} + 2 \, c d x + c^{2}}\right ) - \frac {2 \, a^{2} \log \left (b x + a\right )}{b^{2}} + \frac {2 \, c^{2} \log \left (d x + c\right )}{d^{2}} - \frac {2 \, {\left (b c - a d\right )} x}{b d}\right )} A B b g + A^{2} a g x + \frac {2 \, {\left ({\left (g \log \left (e\right ) + 2 \, g\right )} b c^{2} - 2 \, {\left (g \log \left (e\right ) + g\right )} a c d\right )} B^{2} \log \left (d x + c\right )}{d^{2}} + \frac {4 \, {\left (b^{2} c^{2} g - 2 \, a b c d g + a^{2} d^{2} g\right )} {\left (\log \left (b x + a\right ) \log \left (\frac {b d x + a d}{b c - a d} + 1\right ) + {\rm Li}_2\left (-\frac {b d x + a d}{b c - a d}\right )\right )} B^{2}}{b d^{2}} + \frac {B^{2} b^{2} d^{2} g x^{2} \log \left (e\right )^{2} - 2 \, {\left (2 \, b^{2} c d g \log \left (e\right ) - {\left (g \log \left (e\right )^{2} + 2 \, g \log \left (e\right )\right )} a b d^{2}\right )} B^{2} x + 4 \, {\left (B^{2} b^{2} d^{2} g x^{2} + 2 \, B^{2} a b d^{2} g x + B^{2} a^{2} d^{2} g\right )} \log \left (b x + a\right )^{2} + 4 \, {\left (B^{2} b^{2} d^{2} g x^{2} + 2 \, B^{2} a b d^{2} g x - {\left (b^{2} c^{2} g - 2 \, a b c d g\right )} B^{2}\right )} \log \left (d x + c\right )^{2} + 4 \, {\left (B^{2} b^{2} d^{2} g x^{2} \log \left (e\right ) + 2 \, {\left ({\left (g \log \left (e\right ) + g\right )} a b d^{2} - b^{2} c d g\right )} B^{2} x + {\left ({\left (g \log \left (e\right ) + 2 \, g\right )} a^{2} d^{2} - 2 \, a b c d g\right )} B^{2}\right )} \log \left (b x + a\right ) - 4 \, {\left (B^{2} b^{2} d^{2} g x^{2} \log \left (e\right ) + 2 \, {\left ({\left (g \log \left (e\right ) + g\right )} a b d^{2} - b^{2} c d g\right )} B^{2} x + 2 \, {\left (B^{2} b^{2} d^{2} g x^{2} + 2 \, B^{2} a b d^{2} g x + B^{2} a^{2} d^{2} g\right )} \log \left (b x + a\right )\right )} \log \left (d x + c\right )}{2 \, b d^{2}} \]

input
integrate((b*g*x+a*g)*(A+B*log(e*(b*x+a)^2/(d*x+c)^2))^2,x, algorithm="max 
ima")
 
output
1/2*A^2*b*g*x^2 + 2*(x*log(b^2*e*x^2/(d^2*x^2 + 2*c*d*x + c^2) + 2*a*b*e*x 
/(d^2*x^2 + 2*c*d*x + c^2) + a^2*e/(d^2*x^2 + 2*c*d*x + c^2)) + 2*a*log(b* 
x + a)/b - 2*c*log(d*x + c)/d)*A*B*a*g + (x^2*log(b^2*e*x^2/(d^2*x^2 + 2*c 
*d*x + c^2) + 2*a*b*e*x/(d^2*x^2 + 2*c*d*x + c^2) + a^2*e/(d^2*x^2 + 2*c*d 
*x + c^2)) - 2*a^2*log(b*x + a)/b^2 + 2*c^2*log(d*x + c)/d^2 - 2*(b*c - a* 
d)*x/(b*d))*A*B*b*g + A^2*a*g*x + 2*((g*log(e) + 2*g)*b*c^2 - 2*(g*log(e) 
+ g)*a*c*d)*B^2*log(d*x + c)/d^2 + 4*(b^2*c^2*g - 2*a*b*c*d*g + a^2*d^2*g) 
*(log(b*x + a)*log((b*d*x + a*d)/(b*c - a*d) + 1) + dilog(-(b*d*x + a*d)/( 
b*c - a*d)))*B^2/(b*d^2) + 1/2*(B^2*b^2*d^2*g*x^2*log(e)^2 - 2*(2*b^2*c*d* 
g*log(e) - (g*log(e)^2 + 2*g*log(e))*a*b*d^2)*B^2*x + 4*(B^2*b^2*d^2*g*x^2 
 + 2*B^2*a*b*d^2*g*x + B^2*a^2*d^2*g)*log(b*x + a)^2 + 4*(B^2*b^2*d^2*g*x^ 
2 + 2*B^2*a*b*d^2*g*x - (b^2*c^2*g - 2*a*b*c*d*g)*B^2)*log(d*x + c)^2 + 4* 
(B^2*b^2*d^2*g*x^2*log(e) + 2*((g*log(e) + g)*a*b*d^2 - b^2*c*d*g)*B^2*x + 
 ((g*log(e) + 2*g)*a^2*d^2 - 2*a*b*c*d*g)*B^2)*log(b*x + a) - 4*(B^2*b^2*d 
^2*g*x^2*log(e) + 2*((g*log(e) + g)*a*b*d^2 - b^2*c*d*g)*B^2*x + 2*(B^2*b^ 
2*d^2*g*x^2 + 2*B^2*a*b*d^2*g*x + B^2*a^2*d^2*g)*log(b*x + a))*log(d*x + c 
))/(b*d^2)
 
3.2.31.8 Giac [F]

\[ \int (a g+b g x) \left (A+B \log \left (\frac {e (a+b x)^2}{(c+d x)^2}\right )\right )^2 \, dx=\int { {\left (b g x + a g\right )} {\left (B \log \left (\frac {{\left (b x + a\right )}^{2} e}{{\left (d x + c\right )}^{2}}\right ) + A\right )}^{2} \,d x } \]

input
integrate((b*g*x+a*g)*(A+B*log(e*(b*x+a)^2/(d*x+c)^2))^2,x, algorithm="gia 
c")
 
output
integrate((b*g*x + a*g)*(B*log((b*x + a)^2*e/(d*x + c)^2) + A)^2, x)
 
3.2.31.9 Mupad [F(-1)]

Timed out. \[ \int (a g+b g x) \left (A+B \log \left (\frac {e (a+b x)^2}{(c+d x)^2}\right )\right )^2 \, dx=\int \left (a\,g+b\,g\,x\right )\,{\left (A+B\,\ln \left (\frac {e\,{\left (a+b\,x\right )}^2}{{\left (c+d\,x\right )}^2}\right )\right )}^2 \,d x \]

input
int((a*g + b*g*x)*(A + B*log((e*(a + b*x)^2)/(c + d*x)^2))^2,x)
 
output
int((a*g + b*g*x)*(A + B*log((e*(a + b*x)^2)/(c + d*x)^2))^2, x)